<template>
  <div class="page-main" v-title data-title="公司明细">
    <home-nav :userData="userinfo"></home-nav>
    <div class="banner"><span>公司明细</span></div>
    <div class="container">
      <div class="header">
        <div class="tab-span">
          <span
            v-for="item of activeTabList"
            :key="item.id"
            :class="[{ active: activeTab === item.id }]"
            @click="changeTab(item)"
            >{{ item.name }}</span
          >
        </div>
      </div>
      <div class="content-list">
        <keep-alive>  
          <component :is="activeTab" :companyId="companyId"></component>                
        </keep-alive>
      </div>
    </div>
     <a-back-top  style="right:50px;"/>
  </div>
</template>
<script>
import {filterHasPermission} from '@/utils/hasPermission'
export default {
  name: 'CompanyInfo',
  components: {
    HomeNav: () => import('@/components/layouts/HomeNav'),
    InfoBase: () => import('@views/library/company/information/InfoBase'),
    InfoChange: () => import('@views/library/company/information/InfoChange'),
    InfoPolicy: () => import('@views/library/company/information/InfoPolicy'),
    InfoScale: () => import('@views/library/company/information/InfoScale'),
  },
  data() {
    return {
      userinfo: {
        info: this.$store.getters.userInfo,
        module: 'TaskHome',
      },
      that: this,
      activeTab: 'info-base',
      activeTabList: [
        { name: '基础信息', id: 'info-base' }, 
        { name: '变更信息', id: 'info-change' }, 
        { name: '规模信息', id: 'info-scale' }, 
        { name: '政策利用', id: 'info-policy' }
      ],
      taskList: [],
      companyId: '',
    }
  },
  created () {
    //权限判断
    if(!filterHasPermission('company:readDetail')){
        this.$router.push({path:'/404'})
    }
    
    const obj = this.$route.query
    this.companyId = obj.id;
  },
  mounted() {
  },
  methods: {
    changeTab(item) {
      this.activeTab =item.id
    }
  },
}
</script>
<style lang="less" scoped>
@import '~@assets/less/hte-main.less';
@import './index.less';
.content-list{
  margin-top: 15px;
}
</style>